//
//  XYTImageTextFieldView.m
//  XYTPayOrderSystem
//
//  Created by wupeng on 2017/8/28.
//  Copyright © 2017年 wupeng. All rights reserved.
//

#import "XYTImageTextFieldView.h"

@implementation XYTImageTextFieldView

-(instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        [self.layer setBorderWidth:1.0];
        [self.layer setCornerRadius:2.0];
        [self.layer setBorderColor:[UIColor lightGrayColor].CGColor];
        [self setupUI];
    }
    return self;
}

- (void)setupUI{
    UIImageView *leftImageView = [[UIImageView alloc] initWithFrame:CGRectMake(5, (boundsHeight-18)*0.5, 18, 18)];
    [self addSubview:leftImageView];
    self.imgView = leftImageView;
    
    UITextField *telNumField = [[UITextField alloc] initWithFrame:CGRectMake(CGRectGetMaxX(leftImageView.frame)+5, 0, boundsWidth- CGRectGetMaxX(leftImageView.frame)-5, 40)];
    telNumField.borderStyle = UITextBorderStyleNone;
    telNumField.font = [UIFont systemFontOfSize:14.0f];
    telNumField.textAlignment = NSTextAlignmentLeft;
    telNumField.keyboardType = UIKeyboardTypeNumberPad;
    telNumField.clearButtonMode = UITextFieldViewModeWhileEditing;
    [self addSubview:telNumField];
    self.textField = telNumField;
    
    
    
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
